package com.ssc.blonvia.opencra.intro;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public enum MONTHS {
	JAN, FEB, MAR, APR, MAI, JUN, JUL, AUG, SEP, OCT, NOV, DEC;
	GregorianCalendar gr = new GregorianCalendar();

	private MONTHS() {
	}

	public int getMaxDayInMonth() {
		gr.set(Calendar.MONTH, this.ordinal());
		int result = gr.getActualMaximum(Calendar.DAY_OF_MONTH);
		;
		return result;
	}

	static public MONTHS getCurrentMonth() {
		MONTHS result = null;
		GregorianCalendar gr = new GregorianCalendar();
		gr.setTime(new Date());
		int m = gr.get(Calendar.MONTH);
		for (MONTHS mths : MONTHS.values()) {
			if (mths.ordinal() == m) {
				result = mths;
				break;
			}
		}
		return result;
	}
}